#define _CRT_SECURE_NO_WARNINGS 1
#pragma once

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 200010;

int n, m;
int w[N];

struct Node
{
	int l, r;
	LL dt, mn;
}tr[N * 4];

void pushup(int u)
{
	tr[u].mn = min(tr[u << 1].mn, tr[u << 1 | 1].mn);
}

void pushdown(int u)
{
	auto& root = tr[u], & l = tr[u << 1], & r = tr[u << 1 | 1];
	l.dt += root.dt, l.mn += root.dt;
	r.dt += root.dt, r.mn += root.dt;
	root.dt = 0;
}

void build(int u, int l, int r)
{
	if (l == r) tr[u] = { l, r, 0, w[r] };
	else
	{
		tr[u] = { l, r };
		int mid = l + r >> 1;
		build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
		pushup(u);
	}
}

void update(int u, int l, int r, int d)
{
	if (tr[u].l >= l && tr[u].r <= r)
	{
		tr[u].dt += d, tr[u].mn += d;
	}
	else
	{
		pushdown(u);
		int mid = tr[u].l + tr[u].r >> 1;
		if (l <= mid) update(u << 1, l, r, d);
		if (r > mid) update(u << 1 | 1, l, r, d);
		pushup(u);
	}
}

LL query(int u, int l, int r)
{
	if (tr[u].l >= l && tr[u].r <= r)
	{
		return tr[u].mn;
	}
	else
	{
		pushdown(u);
		int mid = tr[u].l + tr[u].r >> 1;
		LL res = 1e18;
		if (l <= mid) res = min(res, query(u << 1, l, r));
		if (r > mid) res = min(res, query(u << 1 | 1, l, r));
		return res;
	}
}

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d", &w[i]);

	build(1, 0, n - 1);

	scanf("%d", &m);
	while (m--)
	{
		int l, r;
		char c;
		scanf("%d %d%c", &l, &r, &c);
		if (c == '\n')
		{
			if (l <= r) printf("%lld\n", query(1, l, r));
			else printf("%lld\n", min(query(1, 0, r), query(1, l, n - 1)));
		}
		else
		{
			int d;
			scanf("%d", &d);
			if (l <= r) update(1, l, r, d);
			else update(1, 0, r, d), update(1, l, n - 1, d);
		}
	}

	return 0;
}
